package handlers

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"videoPlay/internal/config"
	"videoPlay/internal/dal"
	"videoPlay/internal/http/handlers/video"
	"videoPlay/internal/services/durationTag"
	video2 "videoPlay/internal/services/video"
	"videoPlay/internal/services/videoTag"
)

type router interface {
	Router(router gin.IRouter)
}

func Router(r gin.IRouter) {
	r = r.Group("api")

	// 健康检测
	r.GET("health", func(c *gin.Context) {
		c.String(http.StatusOK, "ok")
	})

	// services
	serviceVideo := video2.New(dal.DB)
	serviceTag := videoTag.New(dal.DB)
	serviceStarDuration := durationTag.New(dal.DB)

	// router
	routers := []router{
		video.New(config.C.DeleteVideoPassword, serviceVideo, serviceTag, serviceStarDuration),
	}
	for _, api := range routers {
		api.Router(r)
	}
}
